//
//  LZHistoryTableViewCell.m
//  沙哈拉FM
//
//  Created by dllo on 15/11/7.
//  Copyright © 2015年 S1mpl3. All rights reserved.
//

#import "LZHistoryTableViewCell.h"
#import "FitHeader.h"
#import "UIImageView+WebCache.h"
@implementation LZHistoryTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return  self;
}
- (void)createView{
    _coverSmallImageView = [[UIImageView alloc]init];
    [self.contentView addSubview:_coverSmallImageView];
    
    _albumTitleLabel = [[UILabel alloc]init];
    [self.contentView addSubview:_albumTitleLabel];
    
    _titleLabel = [[UILabel alloc]init];
    _titleLabel.font = [UIFont systemFontOfSize:13];
    [self.contentView addSubview:_titleLabel];
    
    _playTimeLabel = [[UILabel alloc]init];
    [self.contentView addSubview:_playTimeLabel];
}
- (void)layoutSubviews{
    [super layoutSubviews];
    _coverSmallImageView.frame = CGRectMake(10 * FITWidth, 10 * FITHeight, 80 * FITWidth, 80 * FITHeight);
    _albumTitleLabel.frame = CGRectMake(_coverSmallImageView.frame.origin.x + _coverSmallImageView.frame.size.width + 10 * FITWidth, _coverSmallImageView.frame.origin.y, 280 * FITWidth, 30 * FITHeight);
    _titleLabel.frame = CGRectMake(_albumTitleLabel.frame.origin.x, _albumTitleLabel.frame.origin.y + _albumTitleLabel.frame.size.height + 10 * FITHeight, _albumTitleLabel.frame.size.width, _albumTitleLabel.frame.size.height);
    _playTimeLabel.frame = CGRectMake(_titleLabel.frame.origin.x, _titleLabel.frame.origin.y + _titleLabel.frame.size.height + 10 * FITHeight, _titleLabel.frame.size.width, _titleLabel.frame.size.height);
}
- (void)setDic:(NSDictionary *)dic{
    [_coverSmallImageView sd_setImageWithURL:[NSURL URLWithString:[dic objectForKey:@"coverSmall"]] placeholderImage:[UIImage imageNamed:@"100*100"]];
    _albumTitleLabel.text = [dic objectForKey:@"albumTitle"];
    _titleLabel.text = [dic objectForKey:@"title"];
    
}
@end
